/*
 * Copyright (c) 2013, 5 Idiots. All rights reserved.
 */
package safari.model.sell;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import org.mybatis.spring.SqlSessionTemplate;
/**
 * SellBoardDaoImpl 클래스
 * @author Harry
 *
 */
public class SellBoardDaoImpl implements SellBoardDao {
	private SqlSessionTemplate sqlSessionTemplate;
	public SellBoardDaoImpl(SqlSessionTemplate sqlSessionTemplate){
		this.sqlSessionTemplate=sqlSessionTemplate;
	}
	/**
	 * 판매 글을 등록하는 메서드
	 */
	@Override
	public void insertContent(SellBoardVO svo) throws SQLException {
		sqlSessionTemplate.insert("sell.insertContent", svo);
	}
	/**
	 * 상세 글 보기 페이지를 불러오는 메서드
	 */
	@Override
	public SellBoardVO selectContent(int sellNo) throws SQLException {
		return sqlSessionTemplate.selectOne("sell.selectContent", sellNo);

	}

	@Override
	public void deleteContent(SellBoardVO svo) throws SQLException {
		sqlSessionTemplate.delete("sell.deleteContent", svo);

	}

	@Override
	public void updateContent(SellBoardVO svo) throws SQLException {
		sqlSessionTemplate.update("sell.updateContent", svo);
	}

	@Override
	public void selectUpdate() throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public void selectByTitle() throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public void selectByContent() throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public void selectByProductName() throws SQLException {
		// TODO Auto-generated method stub

	}

	@Override
	public void selectByTitleAndContent() throws SQLException {
		// TODO Auto-generated method stub

	}
	/**
	 * 조회수를 1 증가시키는 메서드
	 */
	@Override
	public void updateHits(Map updateHitsVO) throws SQLException {
		sqlSessionTemplate.update("sell.updateHits",updateHitsVO);
	}
	/**
	 * 판매 게시판 목록을 불러오는 메서드
	 */
	@Override
	public List<SellBoardVO> selectContentList(int nowPage) throws SQLException {
		return sqlSessionTemplate.selectList("sell.selectContentList", nowPage);
	}
	/**
	 * 총 게시물 수를 불러오는 메서드
	 */
	@Override
	public int selectTotalContents() throws SQLException {
		return sqlSessionTemplate.selectOne("sell.selectTotalContents");
	}
	@Override
	public void deleteFileName(String filename) throws SQLException {
		sqlSessionTemplate.selectOne("sell.deleteFileName", filename);
		
	}

}
